﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using MemberServerBLL;

public partial class ControlPanel_System_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            rbl_AllowReg.Items.FindByValue(ConfigurationManager.AppSettings["AllowReg"].ToString()).Selected = true;
            rbl_NeedApproved.Items.FindByValue(ConfigurationManager.AppSettings["NeedApproved"].ToString()).Selected = true;
        }
    }
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            WebConfigTool.SetValue("AllowReg", rbl_AllowReg.SelectedValue, "~/Membership.config");
            ConfigurationManager.AppSettings["AllowReg"] = rbl_AllowReg.SelectedValue;
            WebConfigTool.SetValue("NeedApproved", rbl_NeedApproved.SelectedValue, "~/Membership.config");
            ConfigurationManager.AppSettings["NeedApproved"] = rbl_NeedApproved.SelectedValue;
            lbl_Tips.Text = "保存成功";
        }
        catch (Exception ex)
        {
            lbl_Tips.Text = "发生错误，可能是没有写文件权限或者Membership.config文件格式错误,详情：" + ex.Message;
        }
    }

    protected void btn_OnlineCount_Click(object sender, EventArgs e)
    {
        MemberServerBLL.WebConfigTool.SetValue("ApplicationOnline", "0", "~/Count.config");
        Application["Vonlines"] = 0;
    }
    protected void btn_Visit_Click(object sender, EventArgs e)
    {
        MemberServerBLL.WebConfigTool.SetValue("SiteVisit", "0", "~/Count.config");
    }
}

